﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TsCore;

namespace TsWeb.Sports
{
    public partial class PositionTable : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindSports();
            }
        }

        private void BindSports()
        {
            ComboBoxSports.DataSource = TsSystem.Instance.GetAllSports();
            ComboBoxSports.DataBind();
        }

        protected void ComboBoxSports_SelectedIndexChanged(object sender, EventArgs e)
        {
            Sport selectedSport = TsSystem.Instance.GetSportWithTeams(Int32.Parse(ComboBoxSports.SelectedValue));

            GridViewPositions.DataSource = TsSystem.Instance.GetPositionTable(selectedSport);
            GridViewPositions.DataBind();
        }


    }
}